
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<link rel=stylesheet href='include/hoj.css' type='text/css'>
</head>
<body>
<center>
<div style="width:90%; text-align:left">
<img src="image/logo.png"/>
</div>
<table width=96%> 
	<tr align="center" class='hd' valign="top">
				<th><a href="faqs.php">F.A.Qs</a></th>
		<th><a href="./bbs.php">Web Board</a></th>
		<th><a href="./">Home</a></th>
		<th><a href="./problemset.html">ProblemSet</a></th>
		<th><a href="./status.php">Status</a></th>
		<th><a href="./ranklist.php">Ranklist</a></th>
		<th><a href="./contest.php">Contest</a></th>
		<th><a href=loginpage.php>Login</a></th><th><a href=registerpage.php>Register</a></th>	</tr>
</table>
</center>
<center>
<div class="notice">
	<div>
		<B>Notice:</B>鉴于种种原因，本OJ自下周星期一（3月5号）开始不再全面开放，请各位做好善后事宜，谢谢合作。	</div>
</div>
</center>
</div>
<title>Problem 2441. -- [中山市选2011]小W的问题 -- 衡阳八中OJ离线版-2012-02-29</title><center><h2>2441: [中山市选2011]小W的问题</h2><span class=green>Time Limit: </span>10 Sec&nbsp;&nbsp;<span class=green>Memory Limit: </span>128 MB<br><span class=green>Submit: </span>6&nbsp;&nbsp;<span class=green>Solved: </span>1<br>[<a href='submitpage.php?id=2441'>Submit</a>][<a href='problemstatus.php?id=2441'>Status</a>][<a href='bbs.php?id=2441'>Discuss</a>]</center><h2>Description</h2><div class=content><div class="Section0" style="layout-grid:  15.6pt none">
<h2 style="margin-top: 0pt; margin-bottom: 0pt; text-align: center"><span style="font-weight: bold; font-size: 18pt; font-family: '黑体'; mso-spacerun: 'yes'">小W的问题</span><span style="font-weight: bold; font-size: 18pt; font-family: '黑体'; mso-spacerun: 'yes'"><o:p></o:p></span></h2>
<h2 style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-weight: normal; font-size: 12pt; font-family: '黑体'; mso-spacerun: 'yes'">【问题描述】</span><span style="font-weight: normal; font-size: 12pt; font-family: '黑体'; mso-spacerun: 'yes'"><o:p></o:p></span></h2>
<p class="p0" style="margin-top: 0pt; margin-bottom: 7.8pt; text-indent: 21pt"><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">有一天，小<font face="Times New Roman">W</font><font face="宋体">找了一个笛卡尔坐标系，并在上面选取了</font></span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">N</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">个整点。他发现通过这些整点能够画出很多个&ldquo;<font face="Times New Roman">W</font><font face="宋体">&rdquo;出来。具体来说，对于五个</font></span><span style="font-size: 12pt; font-family: '宋体'; text-decoration: underline; mso-spacerun: 'yes'">不同</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">的点<font face="Times New Roman">(</font></span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">x</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">1</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">y</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">1</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">),&nbsp;(</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">x</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">2</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">y</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">2</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">),&nbsp;(</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">x</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">3</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">y</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">3</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">),&nbsp;(</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">x</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">4</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">y</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">4</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">),&nbsp;(</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">x</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">5</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">y</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">5</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">)<font face="宋体">，如果满足：</font></span><span style="font-size: 12pt; font-family: 'Times New Roman'; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 7.8pt; text-indent: 21pt"><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">&middot;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">x</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">1&nbsp;</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">&lt;&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">x</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">2&nbsp;</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">&lt;&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">x</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">3&nbsp;</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">&lt;&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">x</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">4&nbsp;</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">&lt;&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">x</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">5</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: 'Times New Roman'; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 7.8pt; text-indent: 21pt"><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">&middot;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">y</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">1</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">&nbsp;&gt;&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">y</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">3</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">&nbsp;&gt;&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">y</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">2</span><span style="font-size: 12pt; font-family: 'Times New Roman'; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 7.8pt; text-indent: 21pt"><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">&middot;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">y</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">5</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">&nbsp;&gt;&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">y</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">3</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">&nbsp;&gt;&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">y</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">4</span><span style="font-size: 12pt; font-family: 'Times New Roman'; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 0pt; margin-bottom: 7.8pt; text-indent: 21pt"><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">则称它们构成一个&ldquo;<font face="Times New Roman">W</font><font face="宋体">&rdquo;形。</font></span><span style="font-size: 12pt; font-family: 'Times New Roman'; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<p class="p0" style="margin-top: 7.8pt; margin-bottom: 0pt; text-indent: 24pt"><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">现在，小<font face="Times New Roman">W</font><font face="宋体">想统计&ldquo;</font><font face="Times New Roman">W</font><font face="宋体">&rdquo;形的个数，也就是满足上面条件的五元点组个数。你能帮助他吗？</font></span><span style="font-size: 12pt; font-family: 'Times New Roman'; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<h2 style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">。</span></h2>
</div>
<!--EndFragment--></div><h2>Input</h2><div class=content><h2 style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'"><font face="宋体">&nbsp;&nbsp;&nbsp; 第一行包含一个整数</font></span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">N</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">，表示点的个数。</span><span style="font-size: 12pt; font-family: 'Times New Roman'; mso-spacerun: 'yes'"><o:p></o:p></span></h2>
<p class="p0" style="margin-top: 7.8pt; margin-bottom: 0pt; text-indent: 24pt"><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">下面</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">N</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">行每行两个整数，第</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">i</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">+1<font face="宋体">行为</font><font face="Times New Roman">(</font></span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">x</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">i</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">,&nbsp;</span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">y</span><span style="font-size: 12pt; vertical-align: sub; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">i</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">)<font face="宋体">，表示第</font></span><span style="font-size: 12pt; font-style: italic; font-family: '宋体'; mso-spacerun: 'yes'">i</span><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'">个点的坐标。</span><span style="font-size: 12pt; font-family: 'Times New Roman'; mso-spacerun: 'yes'"><o:p></o:p></span></p>
<h2 style="margin-top: 0pt; margin-bottom: 0pt"></h2></div><h2>Output</h2><div class=content><h2 style="margin-top: 0pt; margin-bottom: 0pt"><span style="font-size: 12pt; font-family: '宋体'; mso-spacerun: 'yes'"><font face="宋体">仅包含一行，为&ldquo;</font><font face="Times New Roman">W</font><font face="宋体">&rdquo;形个数模</font><font face="Times New Roman">1&nbsp;000&nbsp;000&nbsp;007</font><font face="宋体">的值</font></span><span style="font-size: 10.5pt; font-family: '宋体'; mso-spacerun: 'yes'">。</span><span style="font-size: 12pt; font-family: 'Times New Roman'; mso-spacerun: 'yes'"><o:p></o:p></span></h2></div><h2>Sample Input</h2>
			<div class=content><span class=sampledata>6<br />
<br />
1 10<br />
<br />
2 1<br />
<br />
3 5<br />
<br />
4 6<br />
<br />
5 1<br />
<br />
6 10<br />
</span></div><h2>Sample Output</h2>
			<div class=content><span class=sampledata>3<br />
<br />
</span></div><h2>HINT</h2>
			<div class=content><p><p>对于100%的数据满足N &le; 200 000，0 &le; xi &le; 10^9，0 &le; yi &le; 10^9<br /><br />
</p></p></div><h2>Source</h2>
			<div class=content><p><a href='problemset.html?search=Day2'>Day2</a></p></div><center>[<a href='submitpage.php?id=2441'>Submit</a>][<a href='problemstatus.php?id=2441'>Status</a>][<a href='bbs.php?id=2441'>Discuss</a>]</center>﻿<br>

<a href="./"><span class=red>HOME</span></a>
<a href="javascript:history.go(-1)"><span class=red>Back</span></a>

<hr>
<center>
	<div class="footer">
			<a href=setlang.php?lang=ko>한국어</a>&nbsp;
		<a href=setlang.php?lang=cn>中文</a>&nbsp;
		<a href=setlang.php?lang=fa>فارسی</a>&nbsp;
		<a href=setlang.php?lang=en>English</a>&nbsp;
		<a href=setlang.php?lang=th>ไทย</a>
	<br>		<div>版权所有 &copy;2008-2012 WaterPark Organization. | <script src="http://s21.cnzz.com/stat.php?id=2982771&web_id=2982771" language="JavaScript"></script>
</div>
		<div>Based on opensource project <a href="http://hustoj.googlecode.com">hustoj</a>.</div>
	</div>
</center>
</body>
</html>
